package com.zut.hospital.controller.pharmacy;

import com.alibaba.fastjson.JSONObject;
import com.zut.hospital.service.pharmacy.MedPatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;



/**
 * @program: hos-test
 * @description:
 * @author: 杨曼珍
 * @create: 2019-06-10 19:26
 **/
@Controller
@RequestMapping("/hospital")
public class MedPatController {
    @Autowired
    MedPatService medPatService;

    @ResponseBody
    @RequestMapping(value = "/allMedPat")
    public String getAllMedPat(){
        return medPatService.getAll();
    }

    @ResponseBody
    @RequestMapping(value = "/checkPatStatue")
    public String checkStatuePat(){
//        int key = JSONObject.parseObject(data).getInteger("key");
        return medPatService.checkStatue();
    }

    @ResponseBody
    @RequestMapping(value = "/nameMedPat")
    public String nameMedPat(@RequestBody String data){
        String name = JSONObject.parseObject(data).getString("name");
        return medPatService.getPatByName(name);
    }
    @ResponseBody
    @RequestMapping(value = "/medInv")
    public String medInv(){
return medPatService.medInv();
    }

    @ResponseBody
    @RequestMapping(value = "/setInv")
    public String setInv(@RequestBody String data){
        int id = JSONObject.parseObject(data).getInteger("id");
        return medPatService.setInv(id);
    }
}
